package com.zzw.module.service.impl;

import com.zzw.framework.datasource.DynamicDataSource;
import com.zzw.framework.datasource.DynamicDataSourceContextHolder;
import com.zzw.framework.enums.DataSourceType;
import com.zzw.module.mapper.TestMapper;
import com.zzw.module.service.ITestService;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;

@Service
public class TestService implements ITestService {

    @Autowired
    private TestMapper testMapper;

    @Override
    public int copy(String tableSrc, String tableDest) {
        String[] strings = testMapper.selectColumnListButPri(tableSrc);
        String columns = StringUtils.join(strings, ",");
        return testMapper.copyWithTableNameAndColumns(tableSrc, tableDest, columns);
    }
}
